package proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * Created by luzl on 8/7/2017.
 */
public class LogProxy implements InvocationHandler {
    private Object object;
    public LogProxy(Object object){
        this.object=object;
    }
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("Before executed");
        Object object=method.invoke(this.object,args);
        System.out.println("After executed");
        return  object;
    }
}
